package com.niit;
import com.niit.beans.Pig;
import com.niit.beans.Sheep;
import com.niit.beans.User;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class SpringbootDemo1Application {
    public static void main(String[] args) {

        var ioc = SpringApplication.run(SpringbootDemo1Application.class, args);
        String[] beans = ioc.getBeanDefinitionNames();

       /* for(int i =0; i < beans.length; i++){
            System.out.println("====================" + beans[i]);
        }*/
       User user = (User) ioc.getBean("getUser");
        System.out.println("=======user1=====" + user);

        user = (User) ioc.getBean("zhangsan");
        System.out.println("=======user2=====" + user);

        Pig pig = ioc.getBean(Pig.class);
        System.out.println("===============pig============" + pig);

        Sheep sheep = ioc.getBean(Sheep.class);
        System.out.println("=============sheep===============" + sheep);
    }
}
